package cn.rengy.web.framework.web;
//package com.uniontrip.framework.web;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.web.servlet.error.ErrorAttributes;
//import org.springframework.boot.web.servlet.error.ErrorController;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.context.request.ServletWebRequest;
//import org.springframework.web.context.request.WebRequest;
//import org.springframework.web.servlet.ModelAndView;
///**
// * 参考BasicErrorController
// * @author rengy
// *
// */
//@Controller
//@RequestMapping("${server.error.path:/error}")
//public class CustomErrorController implements ErrorController{
//	private static Logger logger = LoggerFactory.getLogger(CustomErrorController.class);
//	
//	@Value("${server.error.path:/error}")
//	private String path = "/error";
//	@Autowired
//	private ErrorAttributes errorAttributes;
//	
//	@RequestMapping(produces = MediaType.TEXT_HTML_VALUE)//produces属性作为匹配规则：表示Request请求的Accept头部需含有text/html。
//	public ModelAndView errorHtml(HttpServletRequest request,
//			HttpServletResponse response) {
//		logger.error("path"+request.getRequestURI());
//		Map<String, Object> model=new HashMap<String,Object>();
//        model.put("message", "error");
//        return new ModelAndView("error",model);
//	}
//
//	@RequestMapping//(produces = MediaType.APPLICATION_JSON_VALUE)
//    @ResponseBody
//	public ResponseEntity<?> errorJson(HttpServletRequest request) {
//		logger.error("path"+request.getRequestURI());
//		return ResponseEntity.ok(new Result(1,"error"));
//	}
//
//	@Override
//	public String getErrorPath() {
//		return path;
//	}
// 
//}
